package com.szx.kaihei.config;

import com.szx.kaihei.Converts.EnumConvert;
import com.szx.kaihei.intercepter.AccessIntercepter;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addFormatters(FormatterRegistry registry) {

        registry.addConverter(new EnumConvert());
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AccessIntercepter())
                .excludePathPatterns( "/user/login", "/user/register", "/code/getCode/**");
    }
}
